/*
 * more forecast courses js
 */
$(document).ready(function(){
	var totalPageCount = document.getElementById("totalPageCount").value;
	var currentPageNum = document.getElementById("currentPageNum").value;
	
	var options = {
		currentPage : parseInt(currentPageNum) + 1,
		totalPages : parseInt(totalPageCount),
		onPageClicked: function(e,originalEvent,type,page){
            jumpToChoosePage(page-1);
        },
		itemContainerClass: function (type, page, current) {
            return (page === current) ? "active" : "pointer-cursor";
        }
	}
	$('#pager').bootstrapPaginator(options);
	
 });

function jumpToChoosePage(pageNum) {

	location.href = getBasePath() + "/moreForecastCourses?pageNum=" + pageNum;
}

function goToPage(){
	var goPageNum = document.getElementById("goPageNum").value;
	var totalPageCount = document.getElementById("totalPageCount").value;
	
	if(parseInt(goPageNum) > parseInt(totalPageCount)){
		location.href = getBasePath() + "/moreForecastCourses?pageNum=0";
	}else{
		location.href = getBasePath() + "/moreForecastCourses?pageNum=" + (parseInt(goPageNum) - 1);
	}
}